<!-- 发现组件 -->
<template>
  <div class="discover">
    <div class="tabs">
      <div class="tabs_wrap">
        <div class="tabs_nav">
          <div class="tab active">
            <span class="ellipsis"> 社区 </span>
          </div>
          <div class="tab">
            <span class="ellipsis"> 店铺街 </span>
          </div>
          <div class="tab">
            <span class="ellipsis"> 视频 </span>
          </div>
        </div>
      </div>
      <div class="tabs_content">
        <ul class="video_list">
          <li
            class="video_item"
            v-for="list in discoverdata"
            :key="list.comment_id"
          >
            <img :src="list.img" />
            <div class="video_info">
              <p v-text="list.goods_name"></p>
              <div class="video_user_info">
                <div class="video_info_left">
                  <img :src="list.user_picture" />
                  <span v-text="list.user_name">YANG</span>
                </div>
                <div class="video_info_right">
                  <i class="iconfont icon-find-liulan-alt"></i>
                  <span v-text="list.dis_browse_num"></span>
                </div>
              </div>
            </div>
          </li>
        </ul>
      </div>
      <div class="footer-cont">没有更多了</div>
    </div>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
import Ajax from "@/api/Ajax";
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {
      discoverdata: [],
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    async discover() {
      let result = await Ajax("/api/discover/find_list", {
        size: 10,
        page: 1,
      });
      this.discoverdata = result.data;
      //   console.log(this.discoverdata);
    },
  },
  mounted() {
    this.discover();
  },
};
</script>
<style lang="less">
.discover {
  margin-bottom: 5rem;
  .tabs {
    position: relative;
    padding-top: 4rem;
    .tabs_wrap {
      height: 4rem;
      top: 0;
      left: 0;
      right: 0;
      z-index: 99;
      overflow: hidden;
      position: absolute;
      .tabs_nav {
        height: 100%;
        padding-bottom: 15px;
        box-sizing: content-box;
        background-color: #fff;
        display: flex;
        .tab {
          font-size: 1.4rem;
          flex: 1;
          cursor: pointer;
          position: relative;
          padding: 0 5px;
          line-height: 4rem;
          text-align: center;
          .ellipsis {
            display: block;
          }
        }
        .active {
          .ellipsis {
            &::after {
              content: " ";
              position: absolute;
              display: block;
              width: 1.9rem;
              height: 0.4rem;
              border-radius: 0.2rem;
              background: #fa2a29;
              left: 50%;
              margin: 0;
              transform: translateX(-50%);
              bottom: 0;
            }
          }
        }
      }
    }
    .tabs_content {
      background-color: #f4f4f4;
      width: 100%;
      .video_list {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 1rem 2% 0;
        .video_item {
          position: relative;
          width: 48.8%;
          border-radius: 1rem;
          margin-bottom: 0.7rem;
          background-color: #fff;
          overflow: hidden;
          img {
            width: 100%;
            height: 63.46vw;
            object-fit: cover;
            display: block;
          }
          .video_info {
            box-sizing: border-box;
            height: 9rem;
            padding: 1.3rem 1rem 1.3rem;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            p {
              width: 100%;
              overflow: hidden;
              display: -webkit-box;
              -webkit-box-orient: vertical;
              -webkit-line-clamp: 2;
              color: #333;
              font-size: 1.3rem;
            }
            .video_user_info {
              display: flex;
              align-items: center;
              justify-content: space-between;
              .video_info_left {
                display: flex;
                align-items: center;
                img {
                  width: 2rem;
                  height: 2rem;
                  border-radius: 50%;
                  margin-right: 0.5rem;
                }
                span {
                  box-sizing: border-box;
                  color: #666;
                }
              }
              .video_info_right {
                i {
                  font-size: 0.8rem;
                  color: #ccc;
                  margin-right: 0.3rem;
                }
                span {
                  color: #ccc;
                }
              }
            }
          }
        }
      }
    }
    .footer-cont {
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.6rem;
      line-height: 3;
      color: #888;
    }
  }
}
</style>